home *** CD-ROM | disk | FTP | other *** search
- Path: news.cc.ic.ac.uk!not-for-mail
- From: nagd@doc.ic.ac.uk (Nicholas d'Alterio)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Function like UPPER but ANY in C ?
- Date: 17 Jan 1996 08:35:54 GMT
- Organization: Imperial College, London, UK
- Message-ID: <4dicda$11c@oban.cc.ic.ac.uk>
- References: <30fb3b91@beachyhd.demon.co.uk>
- NNTP-Posting-Host: oak45.doc.ic.ac.uk
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Adam@beachyhd.demon.co.uk wrote:
- : In a message of 14 Jan 96 Roland Bengtsson wrote to All:
- :
- : RB> I don't know what you mean with ANY but if you want to convert a
- : RB> character to uppercase you can clear the fifth bit like this:
- :
- : RB> #define UPPER(a) (a&(~32))
- :
- : RB> /* in use */
- :
- : RB> int i
- : RB> char str[10] = "Example";
- :
- : RB> for(i=0;str[i];i++)
- : RB> str[i] = UPPER(str[i]);
- :
- : Be careful the character /is/ a alpha character, though. Otherwise "{Example}"
- : becomes "[EXAMPLE]" -- not quite what you were after..
- :
- : .\dam. [Team AMIGA] //\ ad32@brighton.ac.uk \\/
- :
-
- How about the ANSI C function toupper defined in ctypes.h
-
- --
-
- ~=====================================================~
- Nicholas d'Alterio - Msc student Computing Science
- Imperial College, London
- E-Mail: nagd@ic.ac.uk or daltern@ic.ac.uk (closing)
- http://crab.sp.ph.ic.ac.uk/~projects/nick_gid/nick/
- ~=====================================================~
-